package controller.api;
import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Ret;

import common.inter.ServicerStationInter;
import common.inter.StaffStationInter;
import model.MonitoringFacilities;
import service.MonitoringFacilitiesService;

public class ApiMonitoringFacilitiesController extends BaseApiController {
	@Inject MonitoringFacilitiesService monitoringFacilitiesService ;

	@Before(ServicerStationInter.class)
	public void info() {
		Long stationId = getParaToLong("id");
		MonitoringFacilities facilities = MonitoringFacilities.dao.findFirstByStationId(stationId);
        set("data", facilities);
        renderJson();
	}

	@Before(StaffStationInter.class)
	public void save() {
		MonitoringFacilities monitoringFacilities = getModel(MonitoringFacilities.class , "x");
        Ret ret = monitoringFacilitiesService.save(monitoringFacilities ,getStation() , getStaff() );
        renderJson(ret);
	}
}
